package org.scala.test.fun1

class CompareC[T] {
  
  // viewBound
  def choose(first:T,second:T)(implicit t:T => Ordered[T] ):T= {
      if( first >= second) first else second 
   }
  
  // 上下文界定期contextBound
  def select(first:T,second:T)(implicit t: Ordering[T] ):T= {
    if(t.gt(first, second)) first else second
  }
  
  def random(first : T,second :T)(implicit t:Ordering[T]):T={
    import Ordered.orderingToOrdered 
    if(t.gt(first, second)) first else second
  }
}